<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="AddRateSurcharge.aspx.vb" Inherits="GTSWeb_Carrier_Manage" title="GTS Frieght Management System" MaintainScrollPositionOnPostback="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder" Runat="Server">
<h3>Add Rate Surcharge</h3>
    <asp:Literal ID="Message" runat="server"></asp:Literal>
    <table width="100%">
    <tr valign="top"><td>
        <asp:GridView ID="gdvwRateID" runat="server" Caption="Select A Rate Group"
            CellPadding="4" DataKeyNames="RateID" EmptyDataText="No rate groups currently exist for your branch."
            ForeColor="#333333" GridLines="None" Width="100%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:CommandField HeaderText="Select" ShowHeader="True" ShowSelectButton="True" />
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
    </td>
    <td valign="top">
        <asp:GridView ID="grdwRateSurcharge" runat="server" AllowPaging="True" AutoGenerateColumns="False"
            Caption="Surcharges for the Selected Rate" CellPadding="4" DataKeyNames="RateID,SurchargeID"
            DataSourceID="RateSurcharge" ForeColor="#333333" GridLines="None" Width="100%">
            <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <Columns>
                <asp:CommandField ShowEditButton="True" />
                <asp:BoundField DataField="RateID" HeaderText="RateID" ReadOnly="True" SortExpression="RateID"
                    Visible="False" />
                <asp:BoundField DataField="SurchargeID" HeaderText="SurchargeID" ReadOnly="True"
                    SortExpression="SurchargeID" Visible="False" />
                <asp:BoundField DataField="SurchargeName" HeaderText="Surcharge" ReadOnly="True"
                    SortExpression="SurchargeName" />
                <asp:BoundField DataField="ExtraCharge" HeaderText="Extra Charge" SortExpression="ExtraCharge" DataFormatString="{0:C}" HtmlEncode="False" />
                <asp:BoundField DataField="ChargeType" HeaderText="Charge Type" />
            </Columns>
            <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
            <EditRowStyle BackColor="#999999" />
            <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
            <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
            <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
            <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        </asp:GridView>
        <asp:ObjectDataSource ID="RateSurcharge" runat="server" InsertMethod="Insert"
            SelectMethod="GetSurchargeByRateID" TypeName="GTSSystem.BLL.Surcharge" UpdateMethod="UpdateRateSurcharge">
            <UpdateParameters>
                <asp:Parameter Name="SurchargeID" Type="Int32" />
                <asp:Parameter Name="RateID" Type="Int32" />
                <asp:Parameter Name="ExtraCharge" Type="Double" />
                <asp:Parameter Name="ChargeType" Type="String" />
            </UpdateParameters>
            <SelectParameters>
                <asp:ControlParameter ControlID="gdvwRateID" Name="RateID" PropertyName="SelectedValue"
                    Type="Int32" />
            </SelectParameters>
            <InsertParameters>
                <asp:Parameter Name="SurchargeID" Type="Int32" />
                <asp:Parameter Name="RateID" Type="Int32" />
                <asp:Parameter Name="ExtraCharge" Type="Double" />
                <asp:Parameter Name="ChargeType" Type="String" />
            </InsertParameters>
        </asp:ObjectDataSource>
    </td></tr>
    </table>
    <asp:Panel ID="pSurcharge" runat="server">
        <table style="width: 624px">
            <tr>
                <td style="width: 400px; height: 24px; text-align: right;">
                    <strong>Surcharge Type</strong>&nbsp;</td>
                <td style="width: 50px; height: 24px; text-align: left;">
                <asp:DropDownList ID="ddlSurcharge" runat="server" DataSourceID="Surcharge" DataTextField="SurchargeName" DataValueField="SurchargeID" AppendDataBoundItems="True" Width="157px">
                    <asp:ListItem Value="-1">Choose Surcharge Type</asp:ListItem>
                    </asp:DropDownList></td>
                <td style="width: 874px; height: 24px; text-align: left">
                </td>
            </tr>
            <tr>
                <td style="width: 400px; text-align: right;">
                    <strong>Extra Charge&nbsp;</strong>
                </td>
                <td style="width: 50px; text-align: left;">
                <asp:TextBox ID="txtExtraCharge" runat="server"></asp:TextBox>
                </td>
                <td style="width: 874px; text-align: left">
                    <asp:Label ID="asterix" runat="server" ForeColor="Red">*</asp:Label>
                    <asp:Label ID="eMessage" runat="server" ForeColor="Red"></asp:Label></td>
            </tr>
            <tr>
                <td style="width: 400px; height: 24px; text-align: right;">
                    <strong>Rate Type</strong>&nbsp;
                </td>
                <td style="width: 50px; height: 24px; text-align: left;">
                <asp:DropDownList ID="ddlChargeType" runat="server" AppendDataBoundItems="True" DataTextField="RateTypeName" DataValueField="RateTypeName" Width="156px">
                    <asp:ListItem Value="-1">Choose a Rate Type</asp:ListItem>
                    <asp:ListItem Value="1">Fixed</asp:ListItem>
                    <asp:ListItem Value="2">Percentage</asp:ListItem>
                    </asp:DropDownList></td>
                <td style="width: 874px; height: 24px; text-align: left">
                </td>
            </tr>
            <tr>
                <td style="width: 400px; text-align: right">
                </td>
                <td style="width: 50px">
        <asp:LinkButton ID="linkAddSurcharge" runat="server">Add Surcharge</asp:LinkButton></td>
                <td style="width: 874px">
                </td>
            </tr>
        </table>
        &nbsp;</asp:Panel>
        <asp:ObjectDataSource ID="Surcharge" runat="server" OldValuesParameterFormatString="original_{0}"
            SelectMethod="GetSurcharge" TypeName="GTSSystem.BLL.Surcharge">
        </asp:ObjectDataSource>

</asp:Content>

